package com.remembercard;

import java.util.ArrayList;
import java.util.List;

public class Memory {
	private List<Card> myList;
	private int correct;
	private int current;
	
	public Memory(int cant) {
		myList = new ArrayList<Card>();
		loadList(cant);
	}
	
	private void loadList(int cant) {
		Deck myDeck = new Deck();
		for(int i = 0; i < cant; i++) {
			myList.add(myDeck.getNext());
		}
	}
	
	public Card getNext() {
		if(current == myList.size()) {
			return null;
		}
		Card next = myList.get(current); 
		current++;
		return next;
	}
	
	public void setPoints(String cardId, int index) {
		 if(myList.get(index).getCardId().equals(cardId)) {
			 correct++;
		 }
	}
	
	public int getResult() {
		return correct;
	}
	
}
